package zjh_20230403_homework;

import com.alibaba.fastjson.JSON;

public class Demo03 {
    public static void main(String[] args) {
        Computer computer = new Computer();
        computer.name = "联想";
        computer.price = 5600.5;
        Cpu cpu = new Cpu();
        cpu.name = " i9-900";
        computer.cpu = cpu;

        String s = JSON.toJSONString(computer);
        Class<? extends Computer> aClass = computer.getClass();
        Object parse = JSON.parse(s, aClass.getModifiers());
        System.out.println(computer);
        computer.price = 100.0;
        System.out.println(computer);
    }
}
